package com.demoweb.tetris;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.demoweb.model.dao.BoardDao;
import com.demoweb.model.dto.Board;
import com.demoweb.model.dto.Score;
import com.demoweb.ui.ThePager;

@WebServlet("/tetris/list0.action")
public class CommentListServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
//		int currentPage = 1;
//		int pageSize = 2;
//		int dataCount = 0;
//		int pagerSize = 2;
//		String url = "list0.action";
		
		//
		String Title = request.getParameter("title");
		String Comments = request.getParameter("comments");
		
//		if (page != null && page.length() > 0) {
//			currentPage = Integer.parseInt(page);
//		}		
//		int startRow = (currentPage - 1) * pageSize;		
		//데이터베이스에서 데이터 조회
//		String gameNo = request.getParameter("gameNo");
		
//		int no = Integer.parseInt(gameNo);
		
		BoardDao dao = new BoardDao();
		List<Board> boards0 = dao.getBoardByGameNo(3);
		request.setAttribute("boards", boards0);
		System.out.println("list0.action서블릿");
		
	
//		if (groupNo == null || groupNo.length() == 3) {
//			response.sendRedirect("/demoweb/tetris/list0.action");
//			return;
//		}
		RequestDispatcher dispatcher = 
				request.getRequestDispatcher("/WEB-INF/views/tetris/comment.jsp");
//		response.sendRedirect("/demoweb/tetris/view0.action");
		dispatcher.forward(request, response);
		System.out.println("list0.action서블릿");
		return;
		}


	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
